package com.kordar.admin.kernel.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MapUtil {
    public static Map<String, Object> columns(List<Map<String, Object>> list, String key, String value, String defaultKey, String defaultValue) {
        Map<String, Object> labels = new HashMap<>();
        if (defaultKey != null && defaultValue != null) {
            labels.put(defaultKey, defaultValue);
        }
        for(Map<String, Object> map: list)
        {
            labels.put(String.valueOf(map.get(key)), map.get(value));
        }
        return labels;
    }
}
